package yunquan.wang.modules.base.web;

import java.util.List;

import javax.annotation.Resource;
import javax.validation.Valid;

import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import yunquan.wang.base.service.BaseService;
import yunquan.wang.base.web.BaseController;
import yunquan.wang.base.web.TreePojo;
import yunquan.wang.modules.base.entity.Authority;
import yunquan.wang.modules.base.service.AuthorityService;
/**
 * Authority 页面控制器
 * @author 王云权   wangyunquan@gmail.com
 *  用生成器 生成于 2011-09-30 22:37
 *
 */
@Controller
@RequestMapping("/core/authority")
public class AuthorityController extends BaseController<Authority>{
	@Resource(name="authorityService")
	private AuthorityService authorityService;

	@Override
	public BaseService<Authority> getService() {
		return authorityService;
	}
 
	@RequestMapping(value = "/list.do")
	public ModelAndView list() {
		return baseList();
	}

 
	@RequestMapping(value = "/save.do")
	public ModelAndView save(@Valid Authority entity,
			BindingResult bindingResult) {
		return baseSave(entity,bindingResult);
	}

 
	@RequestMapping(value = "/view.do")
	public ModelAndView view(String id) {
 
		return baseView();
	}

	@RequestMapping(value = "/input.do")
	public ModelAndView input(String id) {
		return baseInput();
	}
 
	@RequestMapping(value = "/delete.do")
	public ModelAndView delete(String id) {
		return baseDelete();
	}
	@RequestMapping(value = "/tree.do")
	public @ResponseBody
	List<TreePojo> getOrgTree(Integer level) {
		return authorityService.getAuthorityTree();
	}


}
